﻿using System;
using System.Collections.Generic;
using System.Text;
using Pixysoft.Framework.Verifications;

namespace Pixysoft.Framework.Sockets
{
    public class SocketConfiguration
    {
        int intervalCommandNonDuplicate = 1000 * 1;
        int intervalCommandDuplicate = 300;

        int intervalTriggerConnection = 1000 * 60 * 3;

        int timeoutConnection = 1000 * 60 * 5;
        int timeoutLogin = 10;

        int maxSocketError = 3;
        int maxSocketFrequency = 10;
        int maxConnectionSocket = 10000;

        int intervalSyncSend = 1000 * 10;//10 sec

        public void Verify()
        {
            if (intervalCommandDuplicate > intervalCommandNonDuplicate)
            {
                throw Exceptions.ManualVerificationFailedException("duplicate interval greater than non duplicate interval");
            }

        }

        public int IntervalCommandNonDuplicate
        {
            get { return intervalCommandNonDuplicate; }
            set { intervalCommandNonDuplicate = value; }
        }
        public int IntervalCommandDuplicate
        {
            get { return intervalCommandDuplicate; }
            set { intervalCommandDuplicate = value; }
        }

        public int IntervalTriggerConnection
        {
            get { return intervalTriggerConnection; }
            set { intervalTriggerConnection = value; }
        }

        public int TimeoutConnection
        {
            get { return timeoutConnection; }
            set { timeoutConnection = value; }
        }
        public int TimeoutLogin
        {
            get { return timeoutLogin; }
            set { timeoutLogin = value; }
        }

        public int MaxSocketError
        {
            get { return maxSocketError; }
            set { maxSocketError = value; }
        }
        public int MaxSocketFrequency
        {
            get { return maxSocketFrequency; }
            set { maxSocketFrequency = value; }
        }
        public int MaxConnectionSocket
        {
            get { return maxConnectionSocket; }
            set { maxConnectionSocket = value; }
        }

        public int IntervalSyncSend
        {
            get { return intervalSyncSend; }
            set { intervalSyncSend = value; }
        }
    }
}
